<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('nickname',40)->default('')->comment('昵称');
            $table->string('avatar_url')->default('')->comment('头像路径');
            $table->string('username',40)->default('')->comment('真实姓名');
            $table->string('phone')->nullable()->comment('电话');

            $table->string('password')->default('')->comment('密码');
            $table->tinyInteger('status')->default(0)->comment('状态：0-禁用；1-启用；');

            $table->string('user_role_ids')->default('')->comment('可选身份ids(关联user_role表)');
            $table->string('now_role_id')->default('')->comment('当前身份id(关联user_role表)');
            $table->string('user_auth_id')->default('')->comment('审批角色ids(关联user_auth表)');
            $table->integer('menus_auth_id')->default(0)->comment('菜单角色id(关联user_auth表)');
           
            $table->string('grid_group_id')->default('')->comment('网格组id');
            $table->string('village_id')->default('')->comment('村庄id');
            $table->integer('street_id')->default(0)->comment('街道id');
            $table->integer('project_id')->default(0)->comment('项目id');
            $table->integer('segment_id')->default(0)->comment('号段id');
            
            $table->string('id_obverse_img')->nullable()->comment('身份证正面');
            $table->string('id_reverse_img')->nullable()->comment('身份证反面');
            $table->string('signatures_img')->nullable()->comment('电子签章');
            $table->string('apply_img')->nullable()->comment('申请书');
            $table->integer('apply_status')->default(0)->comment('申请状态0未申请1申请中2通过3拒绝');
           
            $table->string('openid')->default('')->comment('openid');
            $table->string('session_key')->default('')->comment('session_key');
            $table->string('unionid')->default('')->comment('unionid');
            $table->timestamps();
            $table->softDeletes();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `user` comment '微信用户表'");
    
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
